#pragma once

#include "ThreadCache.h"

#include <iostream>
#include <thread>

void *ConcurrentAlloc(size_t size) {
    std::cout << std::this_thread::get_id() << " ConcurrentAlloc size=" << size << std::endl;

    if (pTLSThreadCache == nullptr) {
        pTLSThreadCache = new ThreadCache();
    }

    return pTLSThreadCache->Allocate(size);
}

void ConcurrentFree(void *ptr) {
    assert(ptr);

    pTLSThreadCache->Deallocate(ptr, 0);  // 这里暂时不考虑 size 参数的正确性
}